"""
使用普通方式实现员工 增删改查
"""
import requests

token = "2c9f0d4e-9ccb-4ae0-ab37-281db1685585"
id = "1524641546572464128"

"""添加员工"""
# token需要登录后, 获取. 这里暂时先用postman发个登录请求, 获取token
resp = requests.post(url="http://ihrm-test.itheima.net/api/sys/user",
                     headers={"Authorization": token},
                     json={"username": "hzb", "mobile": "13212234560", "workNumber": "123412412412"})

print("添加员工", resp.json())

"""修改员工"""
resp = requests.put(url="http://ihrm-test.itheima.net/api/sys/user/" + id,
                    headers={"Authorization": token},
                    json={"username": "惠主播"})

print("修改员工", resp.json())

"""查询员工"""
resp = requests.get(url="http://ihrm-test.itheima.net/api/sys/user/" + id,
                    headers={"Authorization": token})

print("查询员工", resp.json())

"""删除员工"""
resp = requests.delete(url="http://ihrm-test.itheima.net/api/sys/user/" + id,
                       headers={"Authorization": token})

print("删除员工", resp.json())
